// stores/user.js
import { defineStore } from 'pinia'

export const useUserStore = defineStore('user', {
  state: () => ({
    isLogin: false,
    username: '',
    avatar: '' ,
    tocken:''
  }),
  actions: {
    login(username, avatar,tocken) { // 修改 login 方法，接收头像参数
      this.isLogin = true
      this.username = username
      this.avatar = avatar
      this.tocken = tocken
    },
    logout() {
      this.isLogin = false
      this.username = ''
      this.avatar = ''
      this.tocken = ''
    }
  }
})